//============================================================================
// Copyright (C) 2013 Brett R. Jones
//
// Issued to public domain 2013
//
// brettjones1900@gmail.com
// http://www.p2panarchy.com
//============================================================================

#include "VxSearchFlags.h"
#include "VxSearchDefs.h"

//============================================================================
//=== constructor ===//
VxSearchFlags::VxSearchFlags()
    : m_u16SearchFlags(0)
{
}

//============================================================================
//! return true if any search bits are set
bool 	VxSearchFlags::hasSearchFlags( void )					
{ 
	return m_u16SearchFlags?1:0; 
}

//============================================================================
//! return true if has any shared files
bool	VxSearchFlags::hasSharedFiles( void )					
{ 
	return ((m_u16SearchFlags & 0x00FF) && (RC_FLAG_ENABLED_SHARED_FILES & m_u16SearchFlags))?1:0; 
}
bool	VxSearchFlags::isFileShareEnabled( void )				
{ 
	return (RC_FLAG_ENABLED_SHARED_FILES & m_u16SearchFlags ) ? 1 : 0; 
}

//============================================================================
void	VxSearchFlags::enableFileShare( bool bEnable )
{
	if( bEnable )
		m_u16SearchFlags |= RC_FLAG_ENABLED_SHARED_FILES;
	else
		m_u16SearchFlags &= ~RC_FLAG_ENABLED_SHARED_FILES;
}

//============================================================================
U16		VxSearchFlags::getSharedFileTypes( void )				
{ 
	return (m_u16SearchFlags & 0x00FF); 
}

//============================================================================
void	VxSearchFlags::setSharedFileTypes( U16 u16FileTypes )	
{ 
	m_u16SearchFlags |= ( u16FileTypes & 0x00FF ); 
}

//============================================================================
void	VxSearchFlags::clearSharedFileTypes( void )			
{ 
	m_u16SearchFlags &= 0xFF00; 
}

//============================================================================
//! return true if has Audio files
bool	VxSearchFlags::hasImageFiles( void )					
{ 
	return (RC_FLAG_HAS_IMAGE_FILES & m_u16SearchFlags)?1:0; 
}

//============================================================================
//! set has image files
void	VxSearchFlags::setHasImageFiles( bool bHasFiles )				
{
	if( bHasFiles )
		m_u16SearchFlags |= RC_FLAG_HAS_IMAGE_FILES;
	else
		m_u16SearchFlags &= ~RC_FLAG_HAS_IMAGE_FILES;
}

//============================================================================
//! return true if has Audio files
bool	VxSearchFlags::hasAudioFiles( void )					
{ 
	return (RC_FLAG_HAS_AUDIO_FILES & m_u16SearchFlags)?1:0; 
}

//============================================================================
//! set has audio files
void	VxSearchFlags::setHasAudioFiles( bool bHasFiles )				
{
	if( bHasFiles )
		m_u16SearchFlags |= RC_FLAG_HAS_AUDIO_FILES;
	else
		m_u16SearchFlags &= ~RC_FLAG_HAS_AUDIO_FILES;
}
//! return true if has Audio files
bool	VxSearchFlags::hasVideoFiles( void )					
{ 
	return (RC_FLAG_HAS_VIDEO_FILES & m_u16SearchFlags)?1:0; 
}

//============================================================================
//! set has audio files
void	VxSearchFlags::setHasVideoFiles( bool bHasFiles )				
{
	if( bHasFiles )
		m_u16SearchFlags |= RC_FLAG_HAS_VIDEO_FILES;
	else
		m_u16SearchFlags &= ~RC_FLAG_HAS_VIDEO_FILES;
}

//============================================================================
//! return true if has Other files
bool	VxSearchFlags::hasOtherFiles( void )					
{ 
	return (RC_FLAG_HAS_OTHER_FILES & m_u16SearchFlags)?1:0; 
}

//============================================================================
//! set has audio files
void	VxSearchFlags::setHasOtherFiles( bool bHasFiles )				
{
	if( bHasFiles )
		m_u16SearchFlags |= RC_FLAG_HAS_OTHER_FILES;
	else
		m_u16SearchFlags &= ~RC_FLAG_HAS_OTHER_FILES;
}

//============================================================================
//! return true if user has set profile picture
bool	VxSearchFlags::hasProfilePicture( void )					
{ 
	return (RC_FLAG_HAS_PROFILE_PIC & m_u16SearchFlags)?1:0; 
}

//============================================================================
//! set has profile picture
void	VxSearchFlags::setHasProfilePicture( bool bHasPicture )				
{
	if( bHasPicture )
		m_u16SearchFlags |= RC_FLAG_HAS_PROFILE_PIC;
	else
		m_u16SearchFlags &= ~RC_FLAG_HAS_PROFILE_PIC;
}

//============================================================================
bool	VxSearchFlags::hasSharedWebCam( void )					
{ 
	return (RC_FLAG_HAS_SHARED_WEBCAM & m_u16SearchFlags)?1:0; 
}

//============================================================================
void	VxSearchFlags::setHasSharedWebCam( bool bHasWebCam )				
{
	if( bHasWebCam )
		m_u16SearchFlags |= RC_FLAG_HAS_SHARED_WEBCAM;
	else
		m_u16SearchFlags &= ~RC_FLAG_HAS_SHARED_WEBCAM;
}

//============================================================================
bool	VxSearchFlags::hasModifiedStoryboard( void )					
{ 
	return (RC_FLAG_HAS_STORY_BOARD & m_u16SearchFlags)?1:0; 
}

//============================================================================
void	VxSearchFlags::setHasModifiedStoryboard( bool bHasStoryBoard )				
{
	if( bHasStoryBoard )
		m_u16SearchFlags |= RC_FLAG_HAS_STORY_BOARD;
	else
		m_u16SearchFlags &= ~RC_FLAG_HAS_STORY_BOARD;
}


